<?php
class Product extends Eloquent {
	
	public static $rules = array(
		'name'=>'required|min:2|unique:products',
		'cigamCodes'=>'componentsrequired|componentsnotempty',
		'components'=>'componentsrequired|componentsnotempty',
		'amounts'=>'componentsrequired|componentsnotempty|componentsamount',
		'costCentres'=>'componentsrequired|componentsnotempty',
		'currentCostsCentres'=>'componentsrequired|componentsnotempty',
		'accessories'=>'accessoryCostsCentres:costCentres',
		'currentAccessories'=>'accessoryCostsCentres:currentCostsCentres',
		'currentAmounts'=>'componentsrequired|componentsnotempty|componentsamount',
	);
	
	public function components() {
		return $this->belongsToMany('Component', 'products_components');
	}
	
}